﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using hzGis.service;
using hzGis.service.impl;

namespace hzGis
{
    public partial class HzGisForm : Form
    {
        private static IFileService fileService;
        private IYdhyService ydhyService;
        public HzGisForm()
        {
            InitializeComponent();
            fileService = new FileService();
            ydhyService = new YdhyService();
            axTOCControl1.SetBuddyControl(axMapControl1);
        }

        private void uploadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 这里弹出选择文件
            OpenFileDialog OpenFdlg = new OpenFileDialog();
            OpenFdlg.Title = "选择shp文件";
            OpenFdlg.Filter = "Shape格式文件（*.shp）|*.shp";
            OpenFdlg.ShowDialog();
            string strFileName = OpenFdlg.FileName;
            if (strFileName == string.Empty)
            {
                return;
            }
            //fileService.openShpFile(strFileName, this.axMapControl1,);
        }

        private void downloadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog OpenFdlg = new OpenFileDialog();
            OpenFdlg.Filter = "lyr文件(*.lyr)|*.lyr";
            if (OpenFdlg.ShowDialog() == DialogResult.OK)
            {
                string pFileName = OpenFdlg.FileName;
                axMapControl1.AddLayerFromFile(pFileName);
                axMapControl1.ActiveView.Refresh();
            }        
        }

        private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
        {
            if (e.button == 4)//鼠标中键
                axMapControl1.Pan();
        }

        private void 用地还原ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List<String> dataPaths = new List<string>()
            {
                @"D:\data\ydbp\bphx\2022\SDDLNEWFX.shp",@"D:\data\ydbp\resultData\1999\441322\DLTB.shp"
            };
           // ydhyService.ydhy(dataPaths, @"D:\data\ydbp\tmp");
        }
    }
}
